import express from 'express'
import { dataSource } from '../db/datasource'
import { Factory } from '../entity/Factory'

const factory = dataSource.getRepository(Factory)
const router = express.Router()

router.get('/', async (req, res) => {
  // 测试代码
  await factory.save({
    name: '测试工厂',
    address: '测试地址'
  })

  res.json({
    code: 0,
    data: null,
    message: 'success'
  })
})

router.post('/', (req, res) => {
  res.json({
    code: 0,
    data: null,
    message: 'success'
  })
})

export default router
